The present invention relates to a device and a method for adjusting, by a desired magnification, the number of pixels of image data which is displayed or printed using a data processing device.
In personal computers, printers and various other data processing devices, when transferring image data between applications having different image data resolutions, an image data adjusting process is carried out for a resolution adjustment by increasing or decreasing the number of pixels of the image data. Further, when storing image data having a large number of pixels into a memory, a process is performed to decrease the number of pixels of the image data for reducing a storage capacity of the memory. The number of the pixels of the image data may also be reduced upon transmitting the image data via a communication line for reducing a transmission time.
When, for example, increasing the number of pixels of image data by integer times (integral magnifications) in width and height directions (X- and Y-directions), respectively, each pixel is copied as many times as represented by the magnifications in the X- and Y-directions. Accordingly, for example, each pixel is copied N times in the X-direction and M times in the Y-direction so that image data having Nxc3x97M times pixels can be obtained.
On the other hand, when increasing the number of pixels of image data by a magnification of a real number not an integer, such as 1.5 times or 2.5 times, in either direction, the pixels to be copied and the pixels not to be copied are mixed to achieve such a magnification.
For increasing the number of pixels, it is the simplest to add a pixel of the same pixel value at a subsequent position. However, in case of an image expressing the halftone, unnatural shade is generated to deteriorate the quality of the image when displayed or printed. This is particularly significant when adjusting the number of pixels of image data by a non-integral magnification.
Accordingly, for achieving smooth change in pixel values of pixels in an output image which are increased by copying, a proper calculation is carried out by referring to a plurality of peripheral pixels. This is called a resampling process, wherein the method of first degree interpolation or the like is used for calculating pixel values of the respective pixels.
However, the foregoing conventional technique has the following problem:
For calculating pixel values of output pixels in an output image using the method of first degree interpolation or the like, it is necessary to provide in advance pixel values of input pixels disposed around each of the output pixels whose pixel values are to be derived. Accordingly, it is necessary that, for example, substantially one-page image data or the like be stored in advance in a buffer memory and then read out in turn to be subjected to a given process.
Thus, the conventional technique can not achieve the effective use of the memory and prolongs an image data processing time.
Therefore, it is an object of the present invention to provide an improved image data adjusting device.
It is another object of the present invention to provide an improved image data adjusting method.
According to one aspect of the present invention, there is provided an image data adjusting device for adjusting the number of pixels of input image data to obtain output image data, the device comprising: a data adjusting table representing magnifications for all the pixels of the input image data per direction in which the number of the pixels of the input image data is adjusted; and a data adjusting section which refers to the data adjusting table to copy each of the pixels serially inputted in a scan direction as many times as represented by the corresponding magnification of the data adjusting table, thereby to obtain the output image data.
According to another aspect of the present invention, there is provided an image data adjusting method for adjusting the number of pixels of input image data to obtain output image data, the method comprising the steps of: preparing a data adjusting table representing magnifications for all the pixels of the input image data per direction in which the number of the pixels of the input image data is adjusted; and referring to the data adjusting table to copy each of the pixels serially inputted in a scan direction as many times as represented by the corresponding magnification of the data adjusting table, thereby to obtain the output image data.
According to another aspect of the present invention, there is provided an image data adjusting device for adjusting the number of pixels of input image data to obtain output image data, the device comprising: a magnification deriving section which derives, based on a predetermined regular relationship between positions of the pixels in the input image data as seen in a pixel adjusting direction of the input image data and magnifications of the corresponding pixels, a magnification for each of the pixels in the pixel adjusting direction of the input image data; and a data adjusting section which copies each of the pixels serially inputted in a scan direction as many times as represented by the magnification derived by the magnification deriving section, thereby to obtain the output image data.
According to another aspect of the present invention, there is provided an image data adjusting method for adjusting the number of pixels of input image data to obtain output image data, the method comprising the steps of: performing a modulo arithmetic relative to a position coordinate of each of the pixels in the input image data as seen in a pixel adjusting direction of the input image data; deriving a magnification for each of the pixels in the pixel adjusting direction of the input image data corresponding to a result of the modulo arithmetic; and copying each of the pixels serially inputted in a scan direction as many times as represented by the derived magnification, thereby to obtain the output image data.
According to another aspect of the present invention, there is provided an image data adjusting method, wherein the number of pixels of input image data is increased by a given magnification in a given direction to obtain output image data and a pixel value of each of pixels of the output image data is subjected to a first degree interpolation based on a position of each of the pixels of the output image data in an image represented by the input image data, the method comprising the steps of: setting a pixel value of each of the pixels of the input image data to be equal to a pixel value of a pixel at a corner of a tetragonal block corresponding to one of the pixels of the input image data and obtained by increasing the number of the pixels of the input image data by the given magnification; and first-degree-interpolating pixel values of the other pixels forming the tetragonal block based on pixel values of pixels at corners of adjacent tetragonal blocks.
According to another aspect of the present invention, there is provided an image data adjusting method for increasing the number of pixels of input image data by a given magnification in a given direction to obtain output image data, the method comprising the steps of: setting a tetragonal lattice formed by the pixels of the input image data at a corresponding position in an image represented by the output image data; and first-degree-interpolating pixel values of output pixels included in the tetragonal lattice based on pixel values of the input pixels forming the tetragonal lattice.
It may be arranged that one of the output pixels in the tetragonal lattice is selected and subjected to a first-degree-interpolation, and each of the pixel values of the other output pixels in the tetragonal lattice is derived by applying to a result of the first-degree-interpolation a conversion process based on a positional relationship to the selected pixel.
According to another aspect of the present invention, there is provided an image data adjusting device, wherein an input image is equally divided into small regions by boundaries parallel to a main scan direction and boundaries parallel to a secondary scan direction, and each of pixel values of output pixels is derived by averaging pixel values of input pixels included in the corresponding small region so as to obtain an output image, the device comprising: an input image buffer for receiving and holding one-line data, as seen in a main scan direction, of pixel values of pixels forming the input image; an intermediate result buffer for accumulating the pixel values of the pixels, received in the input image buffer, in turn in the main scan direction and for holding per the small region the sum of the pixel values derived up to detection of a boundary pixel closest to and prior to the corresponding boundary parallel to the secondary scan direction; and a controller for processing the input image per one line in the secondary direction, reading from the intermediate result buffer the sum of the pixel values in each small region derived up to detection of a boundary pixel closest to and prior to the corresponding boundary parallel to the main scan direction, dividing the sum by the number of the pixels included in the corresponding small region to derive the mean value of the pixel values therein, and setting the mean value as the pixel value of the pixel of the output image.
It may be arranged that a parameter holding section is provided which sets and holds a sampling interval for sampling a portion of the pixels included in each small region and for totaling the pixel values of the sampled pixels, and that the intermediate result buffer totals the pixel values of the sampled pixels per sampling interval by referring to the parameter holding section and holds the sum of the pixel values of the sampled pixels.
It may be arranged that a plurality of sampling regions are set in each of the small regions so that each of the sampling regions includes a plurality of the pixels in the corresponding small region which are continuously arranged in the main scan direction, that a sampling total counter is further provided for totaling the sampled pixel values to obtain a total pixel value per the sampling region, that the controller derives a mean value of the sampled pixel values in each of the sampling regions based on the total pixel value and the number of the pixels included in the corresponding sampling region, and that the intermediate result buffer holds an accumulated value of the mean values for ease of the small regions.
According to another aspect of the present invention, there is provided an integral magnification calculator comprising: a first storage section for storing an N-figure value below decimal point of a result of multiplication in which an integer to be processed is multiplied by a real number; a second storage section for storing an N-figure value below decimal point of the real number; and a calculating section for comparing the value stored in the first storage section and the value stored in the second storage section, and outputting an integral part of the multiplication result when the former value is not smaller than the latter value while outputting a value obtained by raising to unit figures below decimal point of the multiplication result when the former value is smaller than the latter value.
According to another aspect of the present invention, there is provided an image data adjusting device, wherein the product of a coordinate value of each of pixels in an input image and a real number representing a magnification for increasing the number of the pixels of the input image in a given direction is derived and an integer not exceeding the product is determined to be the number of copy times for the corresponding pixel so as to obtain output image data, the device comprising: a register for holding only an N-figure value below decimal point of the product and allowing a value above decimal point of the product to overflow to be invalid; and a magnification deriving section for comparing the value held in the register and an N-figure value below decimal point of the real number every time the product is derived, and determining the number of copy times to be a value obtained by omitting figures below decimal point of the product when the former value is not smaller than the latter value while determining the number of copy times to be a value obtained by raising to unit figures below decimal point of the product when the former value is smaller than the latter value.
According to another aspect of the present invention, there is provided an image data adjusting device, wherein the number of pixels of an input image is increased by a magnification represented by a real number to obtain an output image, the input pixels forming the input image are mapped on the output image to set rectangular regions defined by the mapped input pixels as neighborhood areas, and an integer not exceeding the product of a coordinate value representing a position of the corresponding neighborhood area in the output image and the magnification is determined to be the number of output pixels arranged in a coordinate axis direction in the corresponding neighborhood area, the device comprising: a register for holding only an N-figure value below decimal point of the product and allowing a value above decimal point of the product to overflow to be invalid; and a magnification deriving section for comparing the value held in the register and an N-figure value below decimal point of the real number every time the product is derived, and determining the number of the output pixels to be a value obtained by omitting figures below decimal point of the product when the former value is not smaller than the latter value while determining the number of the output pixels to be a value obtained by raising to unit figures below decimal point of the product when the former value is smaller than the latter value.
It may be arranged that an initial value of an output of the magnification deriving section is set to be a predetermined constant.
According to another aspect of the present invention, there is provided an image data adjusting device, wherein the product of a coordinate value of each of pixels in an input image and a real number representing a magnification for increasing the number of the pixels of the input image in a given direction is derived and an integer not exceeding the product is determined to be the number of copy times for the corresponding pixel so as to obtain output image data, the device comprising: a register for holding only an N-figure value below decimal point of the product and allowing a value above decimal point of the product to overflow to be invalid; a magnification deriving section for comparing the value held in the register and an N-figure value below decimal point of the real number every time the product is derived, and determining the number of copy times to be a value obtained by omitting figures below decimal point of the product when the former value is not smaller than the latter value while determining the number of copy times to be a value obtained by raising to unit figures below decimal point of the product when the former value is smaller than the latter value; and a clipping calculator which, when an edge portion of an output image represented by the output image data falls outside a printable region, derives a pixel magnification for the edge portion of the output image based on data about the printable region and sets the pixel magnification for the edge portion to be an initial value of the number of copy times.